#!/bin/bash
WOEK_NOW=$(dirname $(readlink -f "$0"))"/"
source $WOEK_NOW/config


## export gpio
echo $io_eth > /sys/class/gpio/export 2>/dev/null
echo out > "/sys/class/gpio/gpio"$io_eth"/direction"

start() {
    echo $io_eth_enable   > "/sys/class/gpio/gpio"$io_eth"/value"
}

stop() {
    let disable=!$io_eth_enable
    echo $disable   > "/sys/class/gpio/gpio"$io_eth"/value"
}

case "$1" in
  start)
 	echo  "Starting eth_network power..."
	start
	;;
  stop)
	echo  "Stopping eth_network power..."
	stop
	;;
  restart|reload)
	"$0" stop
    sleep 1
	"$0" start
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit $?

